package cn.edu.nwsuaf.examcenter.service.serviceImpl;

import java.util.List;

import org.springframework.stereotype.Service;

import cn.edu.nwsuaf.examcenter.model.StudentScoreModel;
import cn.edu.nwsuaf.examcenter.pojo.StudentCommonScore;
import cn.edu.nwsuaf.examcenter.pojo.StudentCommonScoreId;
import cn.edu.nwsuaf.examcenter.service.StudentCommonScoreService;

@Service(value="studentCommonScoreService")
public class StudentCommonScoreServiceImpl extends BaseServiceImpl<StudentCommonScore> implements StudentCommonScoreService {

	@Override
	public void getStudentCommonScore(String studentNo, List<String> courceList, List<StudentScoreModel> studentScoreModel) {
		// TODO Auto-generated method stub
		for(int i = 0; i<courceList.size(); i++){
			StudentCommonScoreId id = new StudentCommonScoreId();
			id.setStudentNo(studentNo);
			id.setCourceNo(courceList.get(i));
			
			StudentCommonScore studentCommonScore = super.getById(StudentCommonScore.class, id);
			
			if(studentCommonScore!=null){
				studentScoreModel.get(i).setCommonScore(studentCommonScore.getScore());
			}else{
				studentScoreModel.get(i).setCommonScore(0);
			}
		}
	}

}
